#ifndef CCOMPONENTBRIDGE_H
#define CCOMPONENTBRIDGE_H

#include "BridgeLib_global.h"

#include <QAction>
#include <QObject>
#include <QSystemTrayIcon> 

class BRIDGELIB_EXPORT CComponentBridge : public QObject {
    Q_OBJECT

  public:
    static CComponentBridge* GetInstance();
    static bool ReleaseInstance();

    // 初始化系统托盘
    void InitSystemTrayIcon(QWidget* parent = nullptr);

    // 获取系统图标
    QSystemTrayIcon* GetTrayIcon();

    // 显示系统消息
    void ShowSystemMessage(const QString& title, const QString& msg, QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int msecs = 1000);

    // 设置系统图标提示信息
    void SetSystemIconToolTip(const QString& msg);

  signals:
    void signalTrayActionExit();

  private:
    CComponentBridge(QObject* object = nullptr);
    ~CComponentBridge();

  private:
    static CComponentBridge* s_pComponentBridge;

    QSystemTrayIcon* m_pTrayIcon;
    QMenu* m_pTrayMenu;
    QAction* m_pQuitAction;
};

#endif  // CCOMPONENTBRIDGE_H
